


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html id="htmlId">
<head>
  <title>Coverage Report :: AbstractEntityPersister</title>
  <style type="text/css">
    @import "../../.css/coverage.css";
  </style>
</head>

<body>
<div class="header"></div>

<div class="content">
<div class="breadCrumbs">
    [ <a href="../../index.html">all classes</a> ]
    [ <a href="../index.html">at.dormancy.persister</a> ]
</div>

<h1>Coverage Summary for Class: AbstractEntityPersister (at.dormancy.persister)</h1>

<table class="coverageStats">
<tr>
  <th class="name">Class</th>
<th class="coverageStat 
">
  Class, %
</th>
<th class="coverageStat 
">
  Method, %
</th>
<th class="coverageStat 
">
  Line, %
</th>
</tr>
<tr>
  <td class="name">AbstractEntityPersister</td>
<td class="coverageStat">
  <span class="percent">
    100%
  </span>
  <span class="absValue">
    (1/ 1)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    100%
  </span>
  <span class="absValue">
    (7/ 7)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    100%
  </span>
  <span class="absValue">
    (8/ 8)
  </span>
</td>
</tr>

</table>

<br/>
<br/>


<div class="sourceCode"><i>1</i>&nbsp;/*
<i>2</i>&nbsp; * Copyright 2013 Gregor Schauer
<i>3</i>&nbsp; *
<i>4</i>&nbsp; * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<i>5</i>&nbsp; * you may not use this file except in compliance with the License.
<i>6</i>&nbsp; * You may obtain a copy of the License at
<i>7</i>&nbsp; *
<i>8</i>&nbsp; *      http://www.apache.org/licenses/LICENSE-2.0
<i>9</i>&nbsp; *
<i>10</i>&nbsp; * Unless required by applicable law or agreed to in writing, software
<i>11</i>&nbsp; * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
<i>12</i>&nbsp; * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<i>13</i>&nbsp; * See the License for the specific language governing permissions and
<i>14</i>&nbsp; * limitations under the License.
<i>15</i>&nbsp; */
<i>16</i>&nbsp;package at.dormancy.persister;
<i>17</i>&nbsp;
<i>18</i>&nbsp;import javax.annotation.Nonnull;
<i>19</i>&nbsp;import javax.annotation.Nullable;
<i>20</i>&nbsp;import java.util.IdentityHashMap;
<i>21</i>&nbsp;import java.util.Map;
<i>22</i>&nbsp;import java.util.Set;
<i>23</i>&nbsp;
<i>24</i>&nbsp;/**
<i>25</i>&nbsp; * Abstract implementation containing some convenience methods.
<i>26</i>&nbsp; *
<i>27</i>&nbsp; * @author Gregor Schauer
<i>28</i>&nbsp; */
<b class="fc"><i>29</i>&nbsp;public abstract class AbstractEntityPersister&lt;C&gt; implements EntityPersister&lt;C&gt; {</b>
<i>30</i>&nbsp;	protected Set&lt;Class&lt;? extends C&gt;&gt; supportedTypes;
<i>31</i>&nbsp;
<i>32</i>&nbsp;	@Nullable
<i>33</i>&nbsp;	@Override
<i>34</i>&nbsp;	public &lt;T extends C&gt; C clone(@Nullable T dbObj) {
<b class="fc"><i>35</i>&nbsp;		return clone_(dbObj, createAdjacencyMap());</b>
<i>36</i>&nbsp;	}
<i>37</i>&nbsp;
<i>38</i>&nbsp;	/**
<i>39</i>&nbsp;	 * Clones the given object.
<i>40</i>&nbsp;	 *
<i>41</i>&nbsp;	 * @param dbObj the object to clone
<i>42</i>&nbsp;	 * @param tree  the adjacency map to use for traversal
<i>43</i>&nbsp;	 * @return the cloned object
<i>44</i>&nbsp;	 */
<i>45</i>&nbsp;	@Nullable
<i>46</i>&nbsp;	public abstract &lt;T extends C&gt; C clone_(@Nullable T dbObj, @Nonnull Map&lt;Object, Object&gt; tree);
<i>47</i>&nbsp;
<i>48</i>&nbsp;	@Nullable
<i>49</i>&nbsp;	@Override
<i>50</i>&nbsp;	public &lt;T extends C&gt; C merge(@Nullable T trObj) {
<b class="fc"><i>51</i>&nbsp;		return merge_(trObj, createAdjacencyMap());</b>
<i>52</i>&nbsp;	}
<i>53</i>&nbsp;
<i>54</i>&nbsp;	/**
<i>55</i>&nbsp;	 * Merges the given object into the current persistence context.
<i>56</i>&nbsp;	 *
<i>57</i>&nbsp;	 * @param trObj the object to merge
<i>58</i>&nbsp;	 * @param tree  the adjacency map to use for traversal
<i>59</i>&nbsp;	 * @return the merged object
<i>60</i>&nbsp;	 */
<i>61</i>&nbsp;	@Nullable
<i>62</i>&nbsp;	public abstract &lt;T extends C&gt; C merge_(@Nullable T trObj, @Nonnull Map&lt;Object, Object&gt; tree);
<i>63</i>&nbsp;
<i>64</i>&nbsp;	@Nullable
<i>65</i>&nbsp;	@Override
<i>66</i>&nbsp;	public &lt;T extends C&gt; C merge(@Nullable T trObj, @Nullable T dbObj) {
<b class="fc"><i>67</i>&nbsp;		return merge_(trObj, dbObj, createAdjacencyMap());</b>
<i>68</i>&nbsp;	}
<i>69</i>&nbsp;
<i>70</i>&nbsp;	/**
<i>71</i>&nbsp;	 * Merges the given transient object with the persistent object.
<i>72</i>&nbsp;	 *
<i>73</i>&nbsp;	 * @param trObj the transient object
<i>74</i>&nbsp;	 * @param dbObj the persistent object
<i>75</i>&nbsp;	 * @param tree  the adjacency map to use for traversal
<i>76</i>&nbsp;	 * @return the persistent object with applied property changes
<i>77</i>&nbsp;	 */
<i>78</i>&nbsp;	@Nullable
<i>79</i>&nbsp;	public abstract &lt;T extends C&gt; C merge_(@Nullable T trObj, @Nullable T dbObj, @Nonnull Map&lt;Object, Object&gt; tree);
<i>80</i>&nbsp;
<i>81</i>&nbsp;	/**
<i>82</i>&nbsp;	 * Creates an empty adjacency map used for traversing object graphs.
<i>83</i>&nbsp;	 *
<i>84</i>&nbsp;	 * @return the adjacency map
<i>85</i>&nbsp;	 */
<i>86</i>&nbsp;	@Nonnull
<i>87</i>&nbsp;	protected &lt;K, V&gt; Map&lt;K, V&gt; createAdjacencyMap() {
<b class="fc"><i>88</i>&nbsp;		return new IdentityHashMap&lt;K, V&gt;();</b>
<i>89</i>&nbsp;	}
<i>90</i>&nbsp;
<i>91</i>&nbsp;	/**
<i>92</i>&nbsp;	 * The types of objects supported by this implementation.
<i>93</i>&nbsp;	 *
<i>94</i>&nbsp;	 * @return the supported types
<i>95</i>&nbsp;	 */
<i>96</i>&nbsp;	@Nullable
<i>97</i>&nbsp;	public Set&lt;Class&lt;? extends C&gt;&gt; getSupportedTypes() {
<b class="fc"><i>98</i>&nbsp;		return supportedTypes;</b>
<i>99</i>&nbsp;	}
<i>100</i>&nbsp;
<i>101</i>&nbsp;	/**
<i>102</i>&nbsp;	 * Sets the object types supported by this implementation.
<i>103</i>&nbsp;	 *
<i>104</i>&nbsp;	 * @param supportedTypes the supported types
<i>105</i>&nbsp;	 */
<i>106</i>&nbsp;	public void setSupportedTypes(@Nullable Set&lt;Class&lt;? extends C&gt;&gt; supportedTypes) {
<b class="fc"><i>107</i>&nbsp;		this.supportedTypes = supportedTypes;</b>
<b class="fc"><i>108</i>&nbsp;	}</b>
<i>109</i>&nbsp;}
</div>
</div>

<div class="footer">
    
    <div style="float:right;">generated on 2013-07-31 23:31</div>
</div>
</body>
</html>
